<?php
declare(strict_types=1);

use Phinx\Migration\AbstractMigration;

final class AddProjectModuleNameIndexInEntityTable extends AbstractMigration
{

    public function up()
    {
        $this
            ->table('entity')
            ->addIndex(['project_id', 'module_id', 'name'], ['name' => 'idx_project_module_name'])
            ->addIndex(['project_id', 'module_id', 'code'], ['name' => 'idx_project_module_code'])
            ->save();
    }

    public function down()
    {
        $this
            ->table('entity')
            ->removeIndexByName('idx_project_module_name')
            ->removeIndexByName('idx_project_module_code')
            ->save();
    }
}
